package listdemo;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-11-02ListNode n1 = new ListNode(1);
 * Time：12:13
 */
public class Test {
    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(3);
        mySingleList.addLast(3);
        mySingleList.display();
        MySingleList.ListNode head = mySingleList.deleteDuplication();
        mySingleList.displayByHead(head);
    }
    public static void main7(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(12);
        mySingleList.addLast(8);
        mySingleList.addLast(7);
        mySingleList.addLast(23);
        mySingleList.addLast(9);
        mySingleList.display();
        MySingleList.ListNode head = mySingleList.partition(8);
        mySingleList.displayByHead(head);
    }
    public static void main6(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(5);
        mySingleList.addFirst(6);
        mySingleList.addFirst(7);
        mySingleList.addFirst(7);
        mySingleList.addLast(5);
        mySingleList.display();
        System.out.println("===============");
        mySingleList.clear();
        mySingleList.display();
    }
    public static void main5(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(5);
        mySingleList.addFirst(6);
        mySingleList.addFirst(7);
        mySingleList.addFirst(7);
        mySingleList.addLast(5);
        mySingleList.addLast(6);
        mySingleList.display();
        System.out.println("===============");
        mySingleList.removeAllKey(6);
        mySingleList.display();
    }
    public static void main4(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(5);
        mySingleList.addFirst(6);
        mySingleList.addFirst(7);
        mySingleList.addFirst(7);
        mySingleList.addLast(88);
        mySingleList.addLast(99);
        mySingleList.display();
        System.out.println("===============");
        mySingleList.remove(7);
        mySingleList.remove(5);
        mySingleList.display();
    }
    public static void main3(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(5);
        mySingleList.addFirst(6);
        mySingleList.addFirst(7);
        mySingleList.addLast(88);
        mySingleList.addLast(99);
        mySingleList.display();
        if (mySingleList.contains(7)) {
            System.out.println("有7这个元素");
        }
        if (mySingleList.contains(99)) {
            System.out.println("有99这个元素");
        }
    }
    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(5);
        mySingleList.addFirst(6);
        mySingleList.addFirst(7);
        mySingleList.addLast(88);
        mySingleList.addLast(99);
        mySingleList.display();
        System.out.println("==============");
        try {
            mySingleList.addIndex(1,1);
            mySingleList.addIndex(2,2);
            //mySingleList.addIndex(10,10);
        } catch (SingleListOutOfIndexException e) {
            e.printStackTrace();
        }
        mySingleList.display();
    }
    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.display();
        System.out.println(mySingleList.size());
    }
}
